package com.ly.heart.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import org.springframework.stereotype.Service;
import com.ly.heart.mapper.ErpAddressMapper;
import com.ly.heart.domain.ErpAddress;
import com.ly.heart.service.IErpAddressService;

import javax.annotation.Resource;

/**
 * 地址Service业务层处理
 * 
 * @author wutao
 * @date 2024-05-18
 */
@Service
public class ErpAddressServiceImpl extends ServiceImpl<ErpAddressMapper,ErpAddress> implements IErpAddressService
{
    @Resource
    private ErpAddressMapper erpAddressMapper;

    /**
     * 查询地址
     * 
     * @param id 地址ID
     * @return 地址
     */
    @Override
    public ErpAddress selectErpAddressById(String id)
    {
        return erpAddressMapper.selectErpAddressById(id);
    }

    /**
     * 查询地址列表
     * 
     * @param erpAddress 地址
     * @return 地址
     */
    @Override
    public List<ErpAddress> selectErpAddressList(ErpAddress erpAddress)
    {
        return erpAddressMapper.selectErpAddressList(erpAddress);
    }

    /**
     * 新增地址
     * 
     * @param erpAddress 地址
     * @return 结果
     */
    @Override
    public int insertErpAddress(ErpAddress erpAddress)
    {
        erpAddress.setId(SnowflakeIdWorker.getInstance().nextStringId());
        erpAddress.setCreateTime(DateUtils.getNowDate());
        return erpAddressMapper.insertErpAddress(erpAddress);
    }

    /**
     * 修改地址
     * 
     * @param erpAddress 地址
     * @return 结果
     */
    @Override
    public int updateErpAddress(ErpAddress erpAddress)
    {
        erpAddress.setUpdateTime(DateUtils.getNowDate());
        return erpAddressMapper.updateErpAddress(erpAddress);
    }

    /**
     * 批量删除地址
     * 
     * @param ids 需要删除的地址ID
     * @return 结果
     */
    @Override
    public int deleteErpAddressByIds(String[] ids)
    {
        return erpAddressMapper.deleteErpAddressByIds(ids);
    }

    /**
     * 删除地址信息
     * 
     * @param id 地址ID
     * @return 结果
     */
    @Override
    public int deleteErpAddressById(String id)
    {
        return erpAddressMapper.deleteErpAddressById(id);
    }
}
